package com.lanou3g.ptp.api.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageInfo;
import com.lanou3g.ptp.api.service.ApiStudentService;
import com.lanou3g.ptp.entity.Student;
import com.lanou3g.ptp.student.service.StudentService;


@Service
public class ApiStudentServiceImpl implements ApiStudentService {
    @Reference
    private StudentService studentService;

    //查询所有  和 模糊查询
    @Override
    public PageInfo<Student> findByKeyword(Integer page, Integer size, String keyword) {
        PageInfo<Student> all =null;
//        trim()删除首尾字符串
        if (keyword != null  && !keyword.trim().equals("")){
            //模糊查询
            all =studentService.ByName(page, size, keyword);
        }else {
            //查询所有
            all = studentService.findAll(page, size);

        }
        return all;
    }
}
